GetOpt routines ported from BSD-licensed sources, see comments.